import { http } from '@/utils';

function createArticleAPI(formData) {
	return http({
		method: 'POST',
		url: 'mp/articles',
		data: formData
	})
}

function getArticlesAPI(params) {
	return http({
		method: 'GET',
		url: 'mp/articles',
		params: params
	})
}

function deleteArticleAPI(id) {
	return http({
		url: `mp/articles/${id}`,
		method: 'DELETE'
	})

}

function getArticleAPI(id) {
	return http({
		url: `mp/articles/${id}`,
		method: 'GET'
	})
}

function updateArticleAPI(id, formData) { 
	return http({
		url: `mp/articles/${id}`,
		method: 'PUT',
		data: formData
	})
}

export { createArticleAPI, getArticlesAPI, deleteArticleAPI, getArticleAPI, updateArticleAPI }